package com.shi.yibanjia.controller;

import com.shi.yibanjia.common.Result;
import com.shi.yibanjia.service.PublicityService;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/app/publicity")
public class PublicityController {

    @Resource
    private PublicityService publicityService;

    @GetMapping
    @Cacheable(value = "yibanjia:publicity", key = "'newPublicity'")
    public Result getNewPublicity() {
        return Result.ok(publicityService.getNewPublicity());
    }
}
